{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>instant</th>\n",
       "      <th>season_1</th>\n",
       "      <th>season_2</th>\n",
       "      <th>season_3</th>\n",
       "      <th>season_4</th>\n",
       "      <th>mnth_1</th>\n",
       "      <th>mnth_2</th>\n",
       "      <th>mnth_3</th>\n",
       "      <th>mnth_4</th>\n",
       "      <th>mnth_5</th>\n",
       "      <th>...</th>\n",
       "      <th>weekday_5</th>\n",
       "      <th>weekday_6</th>\n",
       "      <th>temp</th>\n",
       "      <th>atemp</th>\n",
       "      <th>hum</th>\n",
       "      <th>windspeed</th>\n",
       "      <th>holiday</th>\n",
       "      <th>workingday</th>\n",
       "      <th>yr</th>\n",
       "      <th>cnt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0.355170</td>\n",
       "      <td>0.373517</td>\n",
       "      <td>0.828620</td>\n",
       "      <td>0.284606</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>985</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.379232</td>\n",
       "      <td>0.360541</td>\n",
       "      <td>0.715771</td>\n",
       "      <td>0.466215</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>801</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.171000</td>\n",
       "      <td>0.144830</td>\n",
       "      <td>0.449638</td>\n",
       "      <td>0.465740</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1349</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.175530</td>\n",
       "      <td>0.174649</td>\n",
       "      <td>0.607131</td>\n",
       "      <td>0.284297</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1562</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.209120</td>\n",
       "      <td>0.197158</td>\n",
       "      <td>0.449313</td>\n",
       "      <td>0.339143</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1600</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 35 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   instant  season_1  season_2  season_3  season_4  mnth_1  mnth_2  mnth_3  \\\n",
       "0        1         1         0         0         0       1       0       0   \n",
       "1        2         1         0         0         0       1       0       0   \n",
       "2        3         1         0         0         0       1       0       0   \n",
       "3        4         1         0         0         0       1       0       0   \n",
       "4        5         1         0         0         0       1       0       0   \n",
       "\n",
       "   mnth_4  mnth_5  ...  weekday_5  weekday_6      temp     atemp       hum  \\\n",
       "0       0       0  ...          0          1  0.355170  0.373517  0.828620   \n",
       "1       0       0  ...          0          0  0.379232  0.360541  0.715771   \n",
       "2       0       0  ...          0          0  0.171000  0.144830  0.449638   \n",
       "3       0       0  ...          0          0  0.175530  0.174649  0.607131   \n",
       "4       0       0  ...          0          0  0.209120  0.197158  0.449313   \n",
       "\n",
       "   windspeed  holiday  workingday  yr   cnt  \n",
       "0   0.284606        0           0   0   985  \n",
       "1   0.466215        0           0   0   801  \n",
       "2   0.465740        0           1   0  1349  \n",
       "3   0.284297        0           1   0  1562  \n",
       "4   0.339143        0           1   0  1600  \n",
       "\n",
       "[5 rows x 35 columns]"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 数据读取及基本处理\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "from sklearn.metrics import r2_score  #评价回归预测模型的性能\n",
    "df = pd.read_csv(\"FE_day.csv\")\n",
    "\n",
    "#通过观察前5行，了解数据每列（特征）的概况\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 731 entries, 0 to 730\n",
      "Data columns (total 35 columns):\n",
      "instant         731 non-null int64\n",
      "season_1        731 non-null int64\n",
      "season_2        731 non-null int64\n",
      "season_3        731 non-null int64\n",
      "season_4        731 non-null int64\n",
      "mnth_1          731 non-null int64\n",
      "mnth_2          731 non-null int64\n",
      "mnth_3          731 non-null int64\n",
      "mnth_4          731 non-null int64\n",
      "mnth_5          731 non-null int64\n",
      "mnth_6          731 non-null int64\n",
      "mnth_7          731 non-null int64\n",
      "mnth_8          731 non-null int64\n",
      "mnth_9          731 non-null int64\n",
      "mnth_10         731 non-null int64\n",
      "mnth_11         731 non-null int64\n",
      "mnth_12         731 non-null int64\n",
      "weathersit_1    731 non-null int64\n",
      "weathersit_2    731 non-null int64\n",
      "weathersit_3    731 non-null int64\n",
      "weekday_0       731 non-null int64\n",
      "weekday_1       731 non-null int64\n",
      "weekday_2       731 non-null int64\n",
      "weekday_3       731 non-null int64\n",
      "weekday_4       731 non-null int64\n",
      "weekday_5       731 non-null int64\n",
      "weekday_6       731 non-null int64\n",
      "temp            731 non-null float64\n",
      "atemp           731 non-null float64\n",
      "hum             731 non-null float64\n",
      "windspeed       731 non-null float64\n",
      "holiday         731 non-null int64\n",
      "workingday      731 non-null int64\n",
      "yr              731 non-null int64\n",
      "cnt             731 non-null int64\n",
      "dtypes: float64(4), int64(31)\n",
      "memory usage: 200.0 KB\n"
     ]
    }
   ],
   "source": [
    "df.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 从原始数据中分离输入特征x和输出y\n",
    "# 这里我们y有2个取值，原始的MEDV及其log1p之后的值\n",
    "col_y = [\"cnt\"]\n",
    "y = pd.DataFrame(df,columns = col_y)\n",
    "\n",
    "X = df.drop([\"cnt\"], axis = 1)\n",
    "\n",
    "#特征名称，用于后续显示权重系数对应的特征\n",
    "feat_names = X.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(584, 34)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#将数据分割训练数据与测试数据\n",
    "from sklearn.model_selection import train_test_split\n",
    "\n",
    "# 随机采样20%的数据构建测试样本，其余作为训练样本\n",
    "X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=33, test_size=0.2)\n",
    "X_train.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>columns</th>\n",
       "      <th>coef_org</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>yr</td>\n",
       "      <td>4550.708897</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>temp</td>\n",
       "      <td>2654.792827</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>mnth_9</td>\n",
       "      <td>1287.992360</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>atemp</td>\n",
       "      <td>995.293778</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>mnth_10</td>\n",
       "      <td>929.887649</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>weathersit_1</td>\n",
       "      <td>914.410909</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>season_4</td>\n",
       "      <td>830.579518</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>mnth_12</td>\n",
       "      <td>586.296405</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>mnth_8</td>\n",
       "      <td>517.803038</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>weathersit_2</td>\n",
       "      <td>409.589079</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>mnth_11</td>\n",
       "      <td>407.138803</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>weekday_6</td>\n",
       "      <td>238.417312</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>workingday</td>\n",
       "      <td>216.956549</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>mnth_6</td>\n",
       "      <td>189.797216</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>season_2</td>\n",
       "      <td>85.141889</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>weekday_5</td>\n",
       "      <td>77.516263</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>weekday_3</td>\n",
       "      <td>66.464787</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>weekday_4</td>\n",
       "      <td>43.650546</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>mnth_5</td>\n",
       "      <td>5.009200</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>instant</td>\n",
       "      <td>-6.919060</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>weekday_2</td>\n",
       "      <td>-31.943212</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>season_3</td>\n",
       "      <td>-130.807162</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>weekday_0</td>\n",
       "      <td>-191.612446</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>weekday_1</td>\n",
       "      <td>-202.493250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>mnth_7</td>\n",
       "      <td>-203.137582</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>holiday</td>\n",
       "      <td>-263.761415</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>mnth_4</td>\n",
       "      <td>-485.714239</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>mnth_3</td>\n",
       "      <td>-541.439917</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>season_1</td>\n",
       "      <td>-784.914245</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>windspeed</td>\n",
       "      <td>-1174.845790</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>mnth_2</td>\n",
       "      <td>-1207.111892</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>hum</td>\n",
       "      <td>-1298.592138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>weathersit_3</td>\n",
       "      <td>-1323.999988</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>mnth_1</td>\n",
       "      <td>-1486.521042</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         columns     coef_org\n",
       "33            yr  4550.708897\n",
       "27          temp  2654.792827\n",
       "13        mnth_9  1287.992360\n",
       "28         atemp   995.293778\n",
       "14       mnth_10   929.887649\n",
       "17  weathersit_1   914.410909\n",
       "4       season_4   830.579518\n",
       "16       mnth_12   586.296405\n",
       "12        mnth_8   517.803038\n",
       "18  weathersit_2   409.589079\n",
       "15       mnth_11   407.138803\n",
       "26     weekday_6   238.417312\n",
       "32    workingday   216.956549\n",
       "10        mnth_6   189.797216\n",
       "2       season_2    85.141889\n",
       "25     weekday_5    77.516263\n",
       "23     weekday_3    66.464787\n",
       "24     weekday_4    43.650546\n",
       "9         mnth_5     5.009200\n",
       "0        instant    -6.919060\n",
       "22     weekday_2   -31.943212\n",
       "3       season_3  -130.807162\n",
       "20     weekday_0  -191.612446\n",
       "21     weekday_1  -202.493250\n",
       "11        mnth_7  -203.137582\n",
       "31       holiday  -263.761415\n",
       "8         mnth_4  -485.714239\n",
       "7         mnth_3  -541.439917\n",
       "1       season_1  -784.914245\n",
       "30     windspeed -1174.845790\n",
       "6         mnth_2 -1207.111892\n",
       "29           hum -1298.592138\n",
       "19  weathersit_3 -1323.999988\n",
       "5         mnth_1 -1486.521042"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 线性回归\n",
    "#class sklearn.linear_model.LinearRegression(fit_intercept=True, normalize=False, copy_X=True, n_jobs=1)\n",
    "from sklearn.linear_model import LinearRegression\n",
    "\n",
    "# 1.使用默认配置初始化学习器实例\n",
    "lr = LinearRegression()\n",
    "\n",
    "# 2.用训练数据训练模型参数\n",
    "lr.fit(X_train, y_train)\n",
    "\n",
    "# 3. 用训练好的模型对测试集进行预测\n",
    "y_test_pred_lr = lr.predict(X_test)\n",
    "y_train_pred_lr = lr.predict(X_train)\n",
    "\n",
    "\n",
    "# 看看各特征的权重系数，系数的绝对值大小可视为该特征的重要性\n",
    "fs = pd.DataFrame({\"columns\":list(feat_names), \"coef_org\":list((lr.coef_[0,:].T))})\n",
    "fs.sort_values(by=['coef_org'],ascending=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.metrics import mean_squared_error"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The rmse score of LinearRegression on test with original cnt is ：814.474908\n",
      "The rmse score of LinearRegression on test with original cnt is ：742.754351\n"
     ]
    }
   ],
   "source": [
    "# 使用RMSE评价模型在测试集和训练集上的性能，并输出评估结果  均方根误差（RMSE）\n",
    "#测试集\n",
    "print(\"The rmse score of LinearRegression on test with original cnt is ：%f\" %mean_squared_error(y_test.iloc[:,0], y_test_pred_lr[:,0])**0.5)\n",
    "\n",
    "#训练集\n",
    "print(\"The rmse score of LinearRegression on test with original cnt is ：%f\" %mean_squared_error(y_train.iloc[:,0], y_train_pred_lr[:,0])**0.5)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "# plotting\n",
    "import seaborn as sns\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAARgAAADQCAYAAADcQn7hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAb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oskZLez0gJUzBGGlyBV7bgV3i1V3wuBeY6Y+zTwGcizn8Cr+TARuAOVd0QdzNV3YhXT/eXIrIBuK7K+xkpYW5qI1OIyKeBd6vqZY2WxRg5NoMxDCM1bAZjGEZq2AzGMIzUMAVjGEZqmIIxDCM1TMEYhpEapmAMw0iN/w+GqFEku79STQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 288x216 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#还可以观察预测值与真值的散点图\n",
    "plt.figure(figsize=(4, 3))\n",
    "plt.scatter(y_train, y_train_pred_lr)\n",
    "plt.plot([-3, 3], [-3, 3], '--k')   #数据已经标准化，3倍标准差即可\n",
    "plt.axis('tight')\n",
    "plt.xlabel('True price')\n",
    "plt.ylabel('Predicted price')\n",
    "plt.tight_layout()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAegAAAFsCAYAAAAHcSrCAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAeEklEQVR4nO3de5RdZZnn8e9DUiRCgEgICEnaBAUhEEiwCMk4YJzINZjYq7sHGBBobi4QxxaHBsSBNGr3KIhLhnihFWkucpFpNY6wgMYgNi2XBGOEcCvBDAkxCVEuAZFcnvnj7MSTSlXqVFJJvanz/ax1Vu397vfs/e731Dm/s9+9a1dkJpIkqSzb9XYDJEnShgxoSZIKZEBLklQgA1qSpAIZ0JIkFciAliSpQAa0VCcinoyISb3djt4UEX8ZES9GxIqIGLcVt7siIvbuZNnpEfHvPbSd30bEh3tiXdKWZECraXT0wdz+gz8zD8jMB7pYz8iIyIjov4Wa2tuuAs7PzEGZ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TNmbNJ6vv3tb28QziVobW3d4uG8evXqzXp+lwEdEddHxNKIeKKT5RER10REW0TMi4hDNqtFkqSiTJw4kUWLFq2bv/LKKzn00EM56KCDuPzyywF44403mDJlCgcffDAHHnggt99+O1A7el17W+fvfve77LvvvowfP56HHnpo3fpOP/107rzzznXzgwYNAmDFihVMnjyZQw45hDFjxvCjH/1og7YtXryYI444grFjx3LggQfy85//vKF9euCBBzj++OMBmD59OmeccQaTJk1i7733Xi+4b775ZsaPH8/YsWP5+Mc/vi50zz33XFpbWznggAPW9QHUbmN90UUXccghh/D973+/obZ0ppEh7huAa4EbO1l+LLX/b7sPcBjwjeqnJGkbt3r1au6//37OPPNMAO69916ee+45Hn30UTKTqVOn8uCDD7Js2TL22msvfvKTnwDw6quvrreexYsXc/nllzNnzhx22WUXPvShDzFu3LiNbnvgwIH84Ac/YOedd+bll19mwoQJTJ06db2Lrb73ve9x9NFHc+mll7J69WrefPPNTdrPp59+mlmzZvH666/zvve9j3PPPZe2tjZuv/12HnroIVpaWjjvvPO45ZZbOPXUU/niF7/IrrvuyurVq5k8eTLz5s3joIMOAmDIkCE8/vjjm9SOel0GdGY+GBEjN1JlGnBj9c/nH46IwRGxZ2Yu3uzWSZJ6xR//+EfGjh3LokWL2H///TnyyCOBWkDfe++968J1xYoVPPfccxx++OF85jOf4aKLLuL444/n8MMPX299jzzyCJMmTWLo0No/bTrhhBN49tmNn1vPTD772c/y4IMPst1227Fo0SKWLFnCu971rnV1Dj30UM444wxWrlzJRz/6UcaOHbtJ+ztlyhQGDBjAgAED2H333VmyZAn3338/c+bM4dBDD13XJ7vvvjsAd9xxB9dddx2rVq1i8eLFzJ8/f11An3DCCZvUhvZ64hz0MODFuvmFVZkkaRu19hz0ggULyMx156Azk0suuYS5c+cyd+5c2traOPPMM9l33315/PHHGTNmDJ/73Oe44oorGt5W//79WbNmDQBr1qzh7bffBuCWW25h2bJlzJkzh7lz57LHHnts8HfERxxxBA8++CDDhg3j9NNP58YbOxvs3bgB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D2v7jPhuGbqC+Ag4JdVHzwBXFaVd/i+BgZW823V8r3r1tXhZ0d3Ht7qU5KkAjXtELckSSUzoCVJKpABLUlSgQxoSZIKZEBLklQgA1qSpAIZ0JIkFej/A/7e9GM3fmbmAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x360 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#在训练集上观察预测残差的分布，看是否符合模型假设：噪声为0均值的高斯噪声\n",
    "f, ax = plt.subplots(figsize=(7, 5)) \n",
    "f.tight_layout() \n",
    "ax.hist(y_train - y_train_pred_lr, bins=40, label='Residuals Linear', alpha=.5); \n",
    "ax.set_title(\"Histogram of Residuals\") \n",
    "ax.legend(loc='best');"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The rmse score of LinearRegression on test with original cnt is ：814.474908\n",
      "The rmse score of LinearRegression on test with original cnt is ：742.754351\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAegAAAFsCAYAAAAHcSrCAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAeEklEQVR4nO3de5RdZZnn8e9DUiRCgEgICEnaBAUhEEiwCMk4YJzINZjYq7sHGBBobi4QxxaHBsSBNGr3KIhLhnihFWkucpFpNY6wgMYgNi2XBGOEcCvBDAkxCVEuAZFcnvnj7MSTSlXqVFJJvanz/ax1Vu397vfs/e731Dm/s9+9a1dkJpIkqSzb9XYDJEnShgxoSZIKZEBLklQgA1qSpAIZ0JIkFciAliSpQAa0VCcinoyISb3djt4UEX8ZES9GxIqIGLcVt7siIvbuZNnpEfHvPbSd30bEh3ti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auK5s9ezY33ngj11xzzSZtf2vwCFqStIF3vOMdzJ07lyeeeIJdd92VGTNmbNJ6vv3tb28QziVobW3d4uG8evXqzXp+lwEdEddHxNKIeKKT5RER10REW0TMi4hDNqtFkqSiTJw4kUWLFq2bv/LKKzn00EM56KCDuPzyywF44403mDJlCgcffDAHHnggt99+O1A7el17W+fvfve77LvvvowfP56HHnpo3fpOP/107rzzznXzgwYNAmDFihVMnjyZQw45hDFjxvCjH/1og7YtXryYI444grFjx3LggQfy85//vKF9euCBBzj++OMBmD59OmeccQaTJk1i7733Xi+4b775ZsaPH8/YsWP5+Mc/vi50zz33XFpbWznggAPW9QHUbmN90UUXccghh/D973+/obZ0ppEh7huAa4EbO1l+LLX/b7sPcBjwjeqnJGkbt3r1au6//37OPPNMAO69916ee+45Hn30UTKTqVOn8uCDD7Js2TL22msvfvKTnwDw6quvrreexYsXc/nllzNnzhx22WUXPvShDzFu3LiNbnvgwIH84Ac/YOedd+bll19mwoQJTJ06db2Lrb73ve9x9NFHc+mll7J69WrefPPNTdrPp59+mlmzZvH666/zvve9j3PPPZe2tjZuv/12HnroIVpaWjjvvPO45ZZbOPXUU/niF7/IrrvuyurVq5k8eTLz5s3joIMOAmDIkCE8/vjjm9SOel0GdGY+GBEjN1JlGnBj9c/nH46IwRGxZ2Yu3uzWSZJ6xR//+EfGjh3LokWL2H///TnyyCOBWkDfe++968J1xYoVPPfccxx++OF85jOf4aKLLuL444/n8MMPX299jzzyCJMmTWLo0No/bTrhhBN49tmNn1vPTD772c/y4IMPst1227Fo0SKWLFnCu971rnV1Dj30UM444wxWrlzJRz/6UcaOHbtJ+ztlyhQGDBjAgAED2H333VmyZAn3338/c+bM4dBDD13XJ7vvvjsAd9xxB9dddx2rVq1i8eLFzJ8/f11An3DCCZvUhvZ64hz0MODFuvmFVZkkaRu19hz0ggULyMx156Azk0suuYS5c+cyd+5c2traOPPMM9l33315/PHHGTNmDJ/73Oe44oorGt5W//79WbNmDQBr1qzh7bffBuCWW25h2bJlzJkzh7lz57LHHnts8HfERxxxBA8++CDDhg3j9NNP58YbOxvs3bgBAwasm+7Xrx+rVq0iMznttNPW7eszzzzD9OnTeeGFF7jqqqu4//77mTdvHlOmTFmvXTvuuOMmtaG9rXqRWEScExGzI2L2smXLtuampT5j1qxZm72Orq4KfvW+Dv/73Wb5+tyvd7qdrvbp0R8/3+myK1/YeoN1PX019bZghx124JprruErX/kKq1at4uijj+b6669fdwX1okWLWLp0KS+99BI77LADp5xyChdeeOEGQ7yHHXYYP/vZz1i+fDkrV65c7/zsyJEjmTNnDgAzZ85k5cqVQG2YfPfdd6elpYVZs2axYMGGv5cLFixgjz324Oyzz+ass87qkaHltSZPnsydd97J0qVLAfj973/PggULeO2119hxxx3ZZZddWLJkCXfffXePbbNeT/yZ1SJgRN388KpsA5l5HXAdQGtra/bAtiWpz2vkz6K2pHHjxnHQQQdx66238rGPfYynnnqKiRMnArULum6++Wba2tq48MIL2W677WhpaeEb3/jGeuvYc889mT59OhMnTmTw4MHrDUWfffbZTJs2jYMPPphjjjlm3RHoySefzEc+8hHGjBlDa2sr++233wZte+CBB7jyyitpaWlh0KBBnR5BT5kyZd09sCdOnMgnPvGJLvd79OjRfOELX+Coo45izZo1tLS0MGPGDCZMmMC4cePYb7/9GDFiBB/4wAca68juyswuH8BI4IlOlk0B7gYCmAA82sg63//+96ek7vvpT3+62eu4+t5nNrr8lXt/u9nbaG/GL2d0up2u9umRmb/pdNmXn39p8xrWDV31W0+ZP3/+VtmOtr6OXltgdnaQk10eQUfErcAkYLeIWAhcDrRU4f5N4C7gOKANeBP42x79BiFJUhNq5Cruk7pYnkDXYwWSJKlh3klMkgpUO/ZRX9Ld19SAlqTCDBw4kOXLlxvSfUhW/w964MCBDT/Hf5YhSYUZPnw4CxcuxD9H7VsGDhzI8OHDG65vQEtSYVpaWhg1alRvN0O9zCFuSZIKZEBLklQgA1qSpAIZ0JIkFciAliSpQAa0JEkFMqAlSSqQAS1JUoEMaEmSCmRAS5JUIANakqQ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wf/vCA7gVWAysrH4PzqR2HvF+4Dng34Bdq7rd/nzYVh7Af6Y2fD2v7jPhuGbqC+Ag4JdVHzwBXFaVd/i+BgZW823V8r3r1tXhZ0d3Ht7qU5KkAjXtELckSSUzoCVJKpABLUlSgQxoSZIKZEBLklQgA1qSpAIZ0JIkFej/A/7e9GM3fmbmAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x360 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#岭回归／L2正则\n",
    "#class sklearn.linear_model.RidgeCV(alphas=(0.1, 1.0, 10.0), fit_intercept=True, \n",
    "#                                  normalize=False, scoring=None, cv=None, gcv_mode=None, \n",
    "#                                  store_cv_values=False)\n",
    "from sklearn.linear_model import  RidgeCV\n",
    "\n",
    "#1. 设置超参数（正则参数）范围\n",
    "alphas = [ 0.01, 0.1, 1, 10,100]\n",
    "#n_alphas = 20\n",
    "#alphas = np.logspace(-5,2,n_alphas)\n",
    "\n",
    "#2. 生成一个RidgeCV实例\n",
    "ridge = RidgeCV(alphas=alphas, store_cv_values=True)  \n",
    "\n",
    "#3. 模型训练\n",
    "ridge.fit(X_train, y_train)    \n",
    "\n",
    "#4. 预测\n",
    "y_test_pred_ridge = ridge.predict(X_test)\n",
    "y_train_pred_ridge = ridge.predict(X_train)\n",
    "\n",
    "\n",
    "# 使用RMSE评价模型在测试集和训练集上的性能，并输出评估结果  均方根误差（RMSE）\n",
    "#测试集\n",
    "print(\"The rmse score of LinearRegression on test with original cnt is ：%f\" %mean_squared_error(y_test.iloc[:,0], y_test_pred_lr[:,0])**0.5)\n",
    "\n",
    "#训练集\n",
    "print(\"The rmse score of LinearRegression on test with original cnt is ：%f\" %mean_squared_error(y_train.iloc[:,0], y_train_pred_lr[:,0])**0.5)\n",
    "\n",
    "#在训练集上观察预测残差的分布，看是否符合模型假设：噪声为0均值的高斯噪声\n",
    "f, ax = plt.subplots(figsize=(7, 5)) \n",
    "f.tight_layout() \n",
    "ax.hist(y_train - y_train_pred_lr, bins=40, label='Residuals Linear', alpha=.5); \n",
    "ax.set_title(\"Histogram of Residuals\") \n",
    "ax.legend(loc='best');\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZ4AAAEGCAYAAABVSfMhAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nO3de3Cc1Znn8e+jq+93Wb5bJjYmNgFi5LuBEMA2bBISkhBIJjY2G2Y2mdokU7MzzGYr1CZbtcnO1EwVNTPsZoOMvUkIJMBAEsA2DiHIxsayx4BvYIPkG9bF97tkqZ/9o49IW5bakq3ut9X9+1R16e3znrfP021ZP/XbR+8xd0dERCRd8qIuQEREcouCR0RE0krBIyIiaaXgERGRtFLwiIhIWhVEXUCmGzZsmJeVlUVdhohIj7Jp06ZD7l7S3j4FzyWUlZVRVVUVdRkiIj2Kme3paJ9OtYmISFopeEREJK0UPCIiklYKHhERSSsFj4iIpJWCR0RE0krBIyIiaaXgERGRC8Rizv/47XZ2HDyRksdX8IiIyAVe332In1ZWK3hERCQ9KiqrKelfzGeuG5WSx1fwiIjIR3bXn+S19xpYNGs8RQWpiQgFj4iIfKRibQ1FBXl8dea4lI2h4BEREQCOnm7i2c37+cINoxnarzhl4yh4REQEgCc37uXc+RhL5pWldBwFj4iIcL4lxop1e5g7cSjXjBiQ0rEUPCIiwktba6k9cY6lcyekfCwFj4iIUFFZTdnQPtw6eXjKx1LwiIjkuM17j7Jl3zGWzJ1AXp6lfDwFj4hIjnu8spr+vQr40o1j0jKegkdEJIcdOHaWl7fWcv+McfQtLkjLmAoeEZEctuKNGtydRbPHp21MBY+ISI4609T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vwq4qetPVeTSdJFQkdSbR/wqzS1AnZm9BkwP7b9y9xhQa2avJhwzEmhIuH9vWKqiIOybQvwyJ4liwFNh+2dA4gUfW7c3EQ87gELgn83sBqAFuDqhfz3xSxeJdDsFj0hmOkv8GmyY2QTgr4Hp7n7UzJ5o3XcJidfDagxfW/jT//vvEr9G3vXEz36cS+jfK9Qg0u10qk0k9V4HvmJm+eFzl5uJX8xzLfGF0vLMrJT40setdgATw/YA4DRwPPS7s4Nx8ohfnRrgq0DlJeoaCBwM77i+Tnw561ZXkxlXJ5cspHc8Iqn3HPHPb94i/i7kb9y91syeAW4jvpzCPuILgR0Px/yOeBC94u5vmdm/AztDv7UdjHMamGFm/434qbKvXKKufwWeMbNFwMvh+Fa3hhpEup2uTi0SITPr5/EVJ4cSfxc0N4RSb+JLCcwNnw115rFOuXu/bqrrj8Dd7n60Ox5PJJHe8YhE67dmNggoAn7o7rUA7n7WzB4hvrb93nQWFE4H/qNCR1JF73hERCStNLlARETSSsEjIiJppeAREZG0UvCIiEhaKXhERCSt/j9d3KgCeaa/qQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "alpha is: 1.0\n"
     ]
    }
   ],
   "source": [
    "mse_mean = np.mean(ridge.cv_values_, axis = 0)\n",
    "plt.plot(np.log10(alphas), mse_mean.reshape(len(alphas),1)) \n",
    "\n",
    "#这是为了标出最佳参数的位置，不是必须\n",
    "#plt.plot(np.log10(ridge.alpha_)*np.ones(3), [0.28, 0.29, 0.30])\n",
    "\n",
    "plt.xlabel('log(alpha)')\n",
    "plt.ylabel('mse')\n",
    "plt.show()\n",
    "\n",
    "print ('alpha is:', ridge.alpha_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>columns</th>\n",
       "      <th>coef_lr</th>\n",
       "      <th>coef_ridge</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>yr</td>\n",
       "      <td>[4550.70889666036]</td>\n",
       "      <td>[1504.6239241282074]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>temp</td>\n",
       "      <td>[2654.792827053679]</td>\n",
       "      <td>[1778.4934135386839]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>mnth_9</td>\n",
       "      <td>[1287.9923600829795]</td>\n",
       "      <td>[678.352930800002]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>atemp</td>\n",
       "      <td>[995.293777753973]</td>\n",
       "      <td>[1546.3740337700758]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>mnth_10</td>\n",
       "      <td>[929.8876485596038]</td>\n",
       "      <td>[84.87302004857656]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>weathersit_1</td>\n",
       "      <td>[914.4109085449169]</td>\n",
       "      <td>[914.8430917860524]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>season_4</td>\n",
       "      <td>[830.5795181835521]</td>\n",
       "      <td>[767.2053171805248]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>mnth_12</td>\n",
       "      <td>[586.2964051248314]</td>\n",
       "      <td>[-824.9285955290356]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>mnth_8</td>\n",
       "      <td>[517.8030382681909]</td>\n",
       "      <td>[205.68600901571654]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>weathersit_2</td>\n",
       "      <td>[409.589079359022]</td>\n",
       "      <td>[388.86521490051564]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>mnth_11</td>\n",
       "      <td>[407.13880344751755]</td>\n",
       "      <td>[-725.8285290476756]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>weekday_6</td>\n",
       "      <td>[238.41731182263553]</td>\n",
       "      <td>[227.51574041333606]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>workingday</td>\n",
       "      <td>[216.9565489075353]</td>\n",
       "      <td>[212.55871019419283]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>mnth_6</td>\n",
       "      <td>[189.79721645851788]</td>\n",
       "      <td>[369.6631544418524]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>season_2</td>\n",
       "      <td>[85.14188881840869]</td>\n",
       "      <td>[110.99861389403804]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>weekday_5</td>\n",
       "      <td>[77.51626320592133]</td>\n",
       "      <td>[81.39654973376992]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>weekday_3</td>\n",
       "      <td>[66.4647867515144]</td>\n",
       "      <td>[59.8579327714051]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>weekday_4</td>\n",
       "      <td>[43.65054603321954]</td>\n",
       "      <td>[62.79585037134734]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>mnth_5</td>\n",
       "      <td>[5.009200114229683]</td>\n",
       "      <td>[387.7136276923327]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>instant</td>\n",
       "      <td>[-6.919060283513015]</td>\n",
       "      <td>[1.4171574744395912]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>weekday_2</td>\n",
       "      <td>[-31.94321238367033]</td>\n",
       "      <td>[-34.14008002867013]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>season_3</td>\n",
       "      <td>[-130.8071620263899]</td>\n",
       "      <td>[-91.38827520369591]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>weekday_0</td>\n",
       "      <td>[-191.61244555994455]</td>\n",
       "      <td>[-191.85150952242861]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>weekday_1</td>\n",
       "      <td>[-202.49324986968665]</td>\n",
       "      <td>[-205.5744837387574]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>mnth_7</td>\n",
       "      <td>[-203.1375824382942]</td>\n",
       "      <td>[-242.5485815241368]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>holiday</td>\n",
       "      <td>[-263.7614151702459]</td>\n",
       "      <td>[-248.22294108509846]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>mnth_4</td>\n",
       "      <td>[-485.71423873633086]</td>\n",
       "      <td>[106.30651277828122]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>mnth_3</td>\n",
       "      <td>[-541.4399172496005]</td>\n",
       "      <td>[298.5500495645033]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>season_1</td>\n",
       "      <td>[-784.9142449755673]</td>\n",
       "      <td>[-786.8156558708642]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>windspeed</td>\n",
       "      <td>[-1174.8457900947874]</td>\n",
       "      <td>[-1087.7731976474172]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>mnth_2</td>\n",
       "      <td>[-1207.11189184812]</td>\n",
       "      <td>[-143.1252485781706]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>hum</td>\n",
       "      <td>[-1298.5921379821264]</td>\n",
       "      <td>[-1142.3972760585377]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>weathersit_3</td>\n",
       "      <td>[-1323.999987903936]</td>\n",
       "      <td>[-1303.7083066865553]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>mnth_1</td>\n",
       "      <td>[-1486.5210417835065]</td>\n",
       "      <td>[-194.71434966224638]</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         columns                coef_lr             coef_ridge\n",
       "33            yr     [4550.70889666036]   [1504.6239241282074]\n",
       "27          temp    [2654.792827053679]   [1778.4934135386839]\n",
       "13        mnth_9   [1287.9923600829795]     [678.352930800002]\n",
       "28         atemp     [995.293777753973]   [1546.3740337700758]\n",
       "14       mnth_10    [929.8876485596038]    [84.87302004857656]\n",
       "17  weathersit_1    [914.4109085449169]    [914.8430917860524]\n",
       "4       season_4    [830.5795181835521]    [767.2053171805248]\n",
       "16       mnth_12    [586.2964051248314]   [-824.9285955290356]\n",
       "12        mnth_8    [517.8030382681909]   [205.68600901571654]\n",
       "18  weathersit_2     [409.589079359022]   [388.86521490051564]\n",
       "15       mnth_11   [407.13880344751755]   [-725.8285290476756]\n",
       "26     weekday_6   [238.41731182263553]   [227.51574041333606]\n",
       "32    workingday    [216.9565489075353]   [212.55871019419283]\n",
       "10        mnth_6   [189.79721645851788]    [369.6631544418524]\n",
       "2       season_2    [85.14188881840869]   [110.99861389403804]\n",
       "25     weekday_5    [77.51626320592133]    [81.39654973376992]\n",
       "23     weekday_3     [66.4647867515144]     [59.8579327714051]\n",
       "24     weekday_4    [43.65054603321954]    [62.79585037134734]\n",
       "9         mnth_5    [5.009200114229683]    [387.7136276923327]\n",
       "0        instant   [-6.919060283513015]   [1.4171574744395912]\n",
       "22     weekday_2   [-31.94321238367033]   [-34.14008002867013]\n",
       "3       season_3   [-130.8071620263899]   [-91.38827520369591]\n",
       "20     weekday_0  [-191.61244555994455]  [-191.85150952242861]\n",
       "21     weekday_1  [-202.49324986968665]   [-205.5744837387574]\n",
       "11        mnth_7   [-203.1375824382942]   [-242.5485815241368]\n",
       "31       holiday   [-263.7614151702459]  [-248.22294108509846]\n",
       "8         mnth_4  [-485.71423873633086]   [106.30651277828122]\n",
       "7         mnth_3   [-541.4399172496005]    [298.5500495645033]\n",
       "1       season_1   [-784.9142449755673]   [-786.8156558708642]\n",
       "30     windspeed  [-1174.8457900947874]  [-1087.7731976474172]\n",
       "6         mnth_2    [-1207.11189184812]   [-143.1252485781706]\n",
       "29           hum  [-1298.5921379821264]  [-1142.3972760585377]\n",
       "19  weathersit_3   [-1323.999987903936]  [-1303.7083066865553]\n",
       "5         mnth_1  [-1486.5210417835065]  [-194.71434966224638]"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 看看各特征的权重系数，系数的绝对值大小可视为该特征的重要性\n",
    "fs = pd.DataFrame({\"columns\":list(feat_names), \"coef_lr\":list((lr.coef_.T)), \"coef_ridge\":list((ridge.coef_.T))})\n",
    "fs.sort_values(by=['coef_lr'],ascending=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The rmse score of LinearRegression on test with original cnt is ：814.474908\n",
      "The rmse score of LinearRegression on test with original cnt is ：742.754351\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.7/site-packages/sklearn/linear_model/_coordinate_descent.py:1088: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
      "  y = column_or_1d(y, warn=True)\n"
     ]
    }
   ],
   "source": [
    "#### Lasso／L1正则\n",
    "# class sklearn.linear_model.LassoCV(eps=0.001, n_alphas=100, alphas=None, fit_intercept=True, \n",
    "#                                    normalize=False, precompute=’auto’, max_iter=1000, \n",
    "#                                    tol=0.0001, copy_X=True, cv=None, verbose=False, n_jobs=1,\n",
    "#                                    positive=False, random_state=None, selection=’cyclic’)\n",
    "from sklearn.linear_model import LassoCV\n",
    "\n",
    "#1. 设置超参数搜索范围\n",
    "#alphas = [ 0.01, 0.1, 1, 10,100]\n",
    "\n",
    "#2. 生成学习器实例\n",
    "#lasso = LassoCV(alphas=alphas)\n",
    "\n",
    "#1. 设置超参数搜索范围\n",
    "#Lasso可以自动确定最大的alpha，所以另一种设置alpha的方式是设置最小的alpha值（eps） 和 超参数的数目（n_alphas），\n",
    "#然后LassoCV对最小值和最大值之间在log域上均匀取值n_alphas个\n",
    "# np.logspace(np.log10(alpha_max * eps), np.log10(alpha_max),num=n_alphas)[::-1]\n",
    "\n",
    "#2 生成LassoCV实例（默认超参数搜索范围）\n",
    "lasso = LassoCV()  \n",
    "\n",
    "#3. 训练（内含CV）\n",
    "lasso.fit(X_train, y_train)  \n",
    "\n",
    "#4. 测试\n",
    "y_test_pred_lasso = lasso.predict(X_test)\n",
    "y_train_pred_lasso = lasso.predict(X_train)\n",
    "\n",
    "\n",
    "\n",
    "# 使用RMSE评价模型在测试集和训练集上的性能，并输出评估结果  均方根误差（RMSE）\n",
    "#测试集\n",
    "print(\"The rmse score of LinearRegression on test with original cnt is ：%f\" %mean_squared_error(y_test.iloc[:,0], y_test_pred_lr[:,0])**0.5)\n",
    "\n",
    "#训练集\n",
    "print(\"The rmse score of LinearRegression on test with original cnt is ：%f\" %mean_squared_error(y_train.iloc[:,0], y_train_pred_lr[:,0])**0.5)\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZ4AAAEGCAYAAABVSfMhAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nO3de3Cc1Znn8e+jq+93Wb5bJjYmNgFi5LuBEMA2bBISkhBIJjY2G2Y2mdokU7MzzGYr1CZbtcnO1EwVNTPsZoOMvUkIJMBAEsA2DiHIxsayx4BvYIPkG9bF97tkqZ/9o49IW5bakq3ut9X9+1R16e3znrfP021ZP/XbR+8xd0dERCRd8qIuQEREcouCR0RE0krBIyIiaaXgERGRtFLwiIhIWhVEXUCmGzZsmJeVlUVdhohIj7Jp06ZD7l7S3j4FzyWUlZVRVVUVdRkiIj2Kme3paJ9OtYmISFopeEREJK0UPCIiklYKHhERSSsFj4iIpJWCR0RE0krBIyIiaaXgERGRC8Rizv/47XZ2HDyRksdX8IiIyAVe332In1ZWK3hERCQ9KiqrKelfzGeuG5WSx1fwiIjIR3bXn+S19xpYNGs8RQWpiQgFj4iIfKRibQ1FBXl8dea4lI2h4BEREQCOnm7i2c37+cINoxnarzhl4yh4REQEgCc37uXc+RhL5pWldBwFj4iIcL4lxop1e5g7cSjXjBiQ0rEUPCIiwktba6k9cY6lcyekfCwFj4iIUFFZTdnQPtw6eXjKx1LwiIjkuM17j7Jl3zGWzJ1AXp6lfDwFj4hIjnu8spr+vQr40o1j0jKegkdEJIcdOHaWl7fWcv+McfQtLkjLm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CRhH0F7j4D+E5Cez1wh7tPA74CPJrQvwq4qetPVeTSdJFQkdSbR/wqzS1AnZm9BkwP7b9y9xhQa2avJhwzEmhIuH9vWKqiIOybQvwyJ4liwFNh+2dA4gUfW7c3EQ87gELgn83sBqAFuDqhfz3xSxeJdDsFj0hmOkv8GmyY2QTgr4Hp7n7UzJ5o3XcJidfDagxfW/jT//vvEr9G3vXEz36cS+jfK9Qg0u10qk0k9V4HvmJm+eFzl5uJX8xzLfGF0vLMrJT40setdgATw/YA4DRwPPS7s4Nx8ohfnRrgq0DlJeoaCBwM77i+Tnw561ZXkxlXJ5cspHc8Iqn3HPHPb94i/i7kb9y91syeAW4jvpzCPuILgR0Px/yOeBC94u5vmdm/AztDv7UdjHMamGFm/434qbKvXKKufwWeMbNFwMvh+Fa3hhpEup2uTi0SITPr5/EVJ4cSfxc0N4RSb+JLCcwNnw115rFOuXu/bqrrj8Dd7n60Ox5PJJHe8YhE67dmNggoAn7o7rUA7n7WzB4hvrb93nQWFE4H/qNCR1JF73hERCStNLlARETSSsEjIiJppeAREZG0UvCIiEhaKXhERCSt/j9d3KgCeaa/qQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "alpha is: 1.0\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>columns</th>\n",
       "      <th>coef_lr</th>\n",
       "      <th>coef_ridge</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>yr</td>\n",
       "      <td>[4550.70889666036]</td>\n",
       "      <td>[1504.6239241282074]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>temp</td>\n",
       "      <td>[2654.792827053679]</td>\n",
       "      <td>[1778.4934135386839]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>mnth_9</td>\n",
       "      <td>[1287.9923600829795]</td>\n",
       "      <td>[678.352930800002]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>atemp</td>\n",
       "      <td>[995.293777753973]</td>\n",
       "      <td>[1546.3740337700758]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>mnth_10</td>\n",
       "      <td>[929.8876485596038]</td>\n",
       "      <td>[84.87302004857656]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>weathersit_1</td>\n",
       "      <td>[914.4109085449169]</td>\n",
       "      <td>[914.8430917860524]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>season_4</td>\n",
       "      <td>[830.5795181835521]</td>\n",
       "      <td>[767.2053171805248]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>mnth_12</td>\n",
       "      <td>[586.2964051248314]</td>\n",
       "      <td>[-824.9285955290356]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>mnth_8</td>\n",
       "      <td>[517.8030382681909]</td>\n",
       "      <td>[205.68600901571654]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>weathersit_2</td>\n",
       "      <td>[409.589079359022]</td>\n",
       "      <td>[388.86521490051564]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>mnth_11</td>\n",
       "      <td>[407.13880344751755]</td>\n",
       "      <td>[-725.8285290476756]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>weekday_6</td>\n",
       "      <td>[238.41731182263553]</td>\n",
       "      <td>[227.51574041333606]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>workingday</td>\n",
       "      <td>[216.9565489075353]</td>\n",
       "      <td>[212.55871019419283]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>mnth_6</td>\n",
       "      <td>[189.79721645851788]</td>\n",
       "      <td>[369.6631544418524]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>season_2</td>\n",
       "      <td>[85.14188881840869]</td>\n",
       "      <td>[110.99861389403804]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>weekday_5</td>\n",
       "      <td>[77.51626320592133]</td>\n",
       "      <td>[81.39654973376992]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>weekday_3</td>\n",
       "      <td>[66.4647867515144]</td>\n",
       "      <td>[59.8579327714051]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>weekday_4</td>\n",
       "      <td>[43.65054603321954]</td>\n",
       "      <td>[62.79585037134734]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>mnth_5</td>\n",
       "      <td>[5.009200114229683]</td>\n",
       "      <td>[387.7136276923327]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>instant</td>\n",
       "      <td>[-6.919060283513015]</td>\n",
       "      <td>[1.4171574744395912]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>weekday_2</td>\n",
       "      <td>[-31.94321238367033]</td>\n",
       "      <td>[-34.14008002867013]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>season_3</td>\n",
       "      <td>[-130.8071620263899]</td>\n",
       "      <td>[-91.38827520369591]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>weekday_0</td>\n",
       "      <td>[-191.61244555994455]</td>\n",
       "      <td>[-191.85150952242861]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>weekday_1</td>\n",
       "      <td>[-202.49324986968665]</td>\n",
       "      <td>[-205.5744837387574]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>mnth_7</td>\n",
       "      <td>[-203.1375824382942]</td>\n",
       "      <td>[-242.5485815241368]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>holiday</td>\n",
       "      <td>[-263.7614151702459]</td>\n",
       "      <td>[-248.22294108509846]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>mnth_4</td>\n",
       "      <td>[-485.71423873633086]</td>\n",
       "      <td>[106.30651277828122]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>mnth_3</td>\n",
       "      <td>[-541.4399172496005]</td>\n",
       "      <td>[298.5500495645033]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>season_1</td>\n",
       "      <td>[-784.9142449755673]</td>\n",
       "      <td>[-786.8156558708642]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>windspeed</td>\n",
       "      <td>[-1174.8457900947874]</td>\n",
       "      <td>[-1087.7731976474172]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>mnth_2</td>\n",
       "      <td>[-1207.11189184812]</td>\n",
       "      <td>[-143.1252485781706]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>hum</td>\n",
       "      <td>[-1298.5921379821264]</td>\n",
       "      <td>[-1142.3972760585377]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>weathersit_3</td>\n",
       "      <td>[-1323.999987903936]</td>\n",
       "      <td>[-1303.7083066865553]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>mnth_1</td>\n",
       "      <td>[-1486.5210417835065]</td>\n",
       "      <td>[-194.71434966224638]</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         columns                coef_lr             coef_ridge\n",
       "33            yr     [4550.70889666036]   [1504.6239241282074]\n",
       "27          temp    [2654.792827053679]   [1778.4934135386839]\n",
       "13        mnth_9   [1287.9923600829795]     [678.352930800002]\n",
       "28         atemp     [995.293777753973]   [1546.3740337700758]\n",
       "14       mnth_10    [929.8876485596038]    [84.87302004857656]\n",
       "17  weathersit_1    [914.4109085449169]    [914.8430917860524]\n",
       "4       season_4    [830.5795181835521]    [767.2053171805248]\n",
       "16       mnth_12    [586.2964051248314]   [-824.9285955290356]\n",
       "12        mnth_8    [517.8030382681909]   [205.68600901571654]\n",
       "18  weathersit_2     [409.589079359022]   [388.86521490051564]\n",
       "15       mnth_11   [407.13880344751755]   [-725.8285290476756]\n",
       "26     weekday_6   [238.41731182263553]   [227.51574041333606]\n",
       "32    workingday    [216.9565489075353]   [212.55871019419283]\n",
       "10        mnth_6   [189.79721645851788]    [369.6631544418524]\n",
       "2       season_2    [85.14188881840869]   [110.99861389403804]\n",
       "25     weekday_5    [77.51626320592133]    [81.39654973376992]\n",
       "23     weekday_3     [66.4647867515144]     [59.8579327714051]\n",
       "24     weekday_4    [43.65054603321954]    [62.79585037134734]\n",
       "9         mnth_5    [5.009200114229683]    [387.7136276923327]\n",
       "0        instant   [-6.919060283513015]   [1.4171574744395912]\n",
       "22     weekday_2   [-31.94321238367033]   [-34.14008002867013]\n",
       "3       season_3   [-130.8071620263899]   [-91.38827520369591]\n",
       "20     weekday_0  [-191.61244555994455]  [-191.85150952242861]\n",
       "21     weekday_1  [-202.49324986968665]   [-205.5744837387574]\n",
       "11        mnth_7   [-203.1375824382942]   [-242.5485815241368]\n",
       "31       holiday   [-263.7614151702459]  [-248.22294108509846]\n",
       "8         mnth_4  [-485.71423873633086]   [106.30651277828122]\n",
       "7         mnth_3   [-541.4399172496005]    [298.5500495645033]\n",
       "1       season_1   [-784.9142449755673]   [-786.8156558708642]\n",
       "30     windspeed  [-1174.8457900947874]  [-1087.7731976474172]\n",
       "6         mnth_2    [-1207.11189184812]   [-143.1252485781706]\n",
       "29           hum  [-1298.5921379821264]  [-1142.3972760585377]\n",
       "19  weathersit_3   [-1323.999987903936]  [-1303.7083066865553]\n",
       "5         mnth_1  [-1486.5210417835065]  [-194.71434966224638]"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mse_mean = np.mean(ridge.cv_values_, axis = 0)\n",
    "plt.plot(np.log10(alphas), mse_mean.reshape(len(alphas),1)) \n",
    "\n",
    "#这是为了标出最佳参数的位置，不是必须\n",
    "#plt.plot(np.log10(ridge.alpha_)*np.ones(3), [0.28, 0.29, 0.30])\n",
    "\n",
    "plt.xlabel('log(alpha)')\n",
    "plt.ylabel('mse')\n",
    "plt.show()\n",
    "\n",
    "print ('alpha is:', ridge.alpha_)\n",
    "\n",
    "# 看看各特征的权重系数，系数的绝对值大小可视为该特征的重要性\n",
    "fs = pd.DataFrame({\"columns\":list(feat_names), \"coef_lr\":list((lr.coef_.T)), \"coef_ridge\":list((ridge.coef_.T))})\n",
    "fs.sort_values(by=['coef_lr'],ascending=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
